package com.demo.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.demo.service.StudentManager;
import com.util.ZookeeperClient;

@Controller
@RequestMapping("/student")

public class StudentController {
	private Logger logger = LoggerFactory.getLogger(StudentController.class);
	
    @Autowired
    StudentManager manager;
 
    @RequestMapping(value = "/getStudentInfo", method = RequestMethod.GET)
    @ResponseBody
    public String getStudentInfo(HttpServletRequest request) {
    	
    	logger.info(request.getSession().toString());
    	
    	manager.getAllStudents();
//    	try {
//			Thread.sleep(600);
//		} catch (InterruptedException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
        return manager.getAllStudents().toString()+ZookeeperClient.jettyWebServer;
    }


}

